package com.hulizuofang.wol.chat.client.gin;

import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.gwtplatform.mvp.client.gin.DefaultModule;
import com.hulizuofang.wol.chat.client.place.ClientPlaceManager;
import com.hulizuofang.wol.chat.client.place.DefaultPlace;
import com.hulizuofang.wol.chat.client.place.NameTokens;
import com.hulizuofang.wol.chat.client.presenter.ChatPagePresenter;
import com.hulizuofang.wol.chat.client.presenter.MainPagePresenter;
import com.hulizuofang.wol.chat.client.presenter.StartPagePresenter;
import com.hulizuofang.wol.chat.client.presenter.WhoisOnlinePagePresenter;
import com.hulizuofang.wol.chat.client.ui.chat.SetLoginPanel;
import com.hulizuofang.wol.chat.client.ui.chat.WhoisOnlinePanel;
import com.hulizuofang.wol.chat.client.view.ChatPageViewImpl;
import com.hulizuofang.wol.chat.client.view.MainPageViewImpl;
import com.hulizuofang.wol.chat.client.view.StartPageViewImpl;
import com.hulizuofang.wol.chat.client.view.WhoisOnlinePageViewImpl;

public class ClientModule extends AbstractPresenterModule {

	@Override
	protected void configure() {
		install(new DefaultModule(ClientPlaceManager.class));
		
		bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.START); // CONSTANT here ?
		bind(ClientI18nMessages.class).in(Singleton.class);

		//bind(LoadingPanel.class).to(LoadingPanelPopupImpl.class).in(Singleton.class);

		bind(SetLoginPanel.class);
		bind(WhoisOnlinePanel.class);

		bindPresenter(StartPagePresenter.class, StartPagePresenter.PageView.class, StartPageViewImpl.class, StartPagePresenter.PageProxy.class);
		bindPresenter(WhoisOnlinePagePresenter.class, WhoisOnlinePagePresenter.PageView.class, WhoisOnlinePageViewImpl.class, WhoisOnlinePagePresenter.PageProxy.class);
		bindPresenter(ChatPagePresenter.class, ChatPagePresenter.PageView.class, ChatPageViewImpl.class, ChatPagePresenter.PageProxy.class);
		
		bindPresenter(MainPagePresenter.class, MainPagePresenter.PageView.class, MainPageViewImpl.class, MainPagePresenter.PageProxy.class);
	}
}
